#include "parallel.h"

int vector_point_product(double A_x[], double B_x[], int n){
    double sum = 0.0;
    for(int j = 0; j < 10000; j++){
        sum = 0.0;
        #pragma omp parallel for  reduction(+:sum)
        for(int i = 0; i < n; i++)
            sum += A_x[i] * B_x[i];
    }
    return sum;
}

int main(int argc, char **argv){
    int n = 100000;
    double arr_x[n], arr_y[n];
    for(int i = 0; i < n ; i++) {
        arr_x[i] = rand();
        arr_y[i] = rand();
    }
    for(int i = 0; i < threads_list_num; i++){
        double start, end; 
        int thread = threads[i]; 
        omp_set_num_threads(thread);
        start = omp_get_wtime(); 
        double sum = vector_point_product(arr_x, arr_y, n);
        end = omp_get_wtime(); 
        printf("A * B = %lf", sum);
        printf("thread %d Work took %f seconds\n",thread, end - start);
    }
}


